#!/bin/sh

cd %OPTWARE_TARGET_PREFIX%/share/emacs/${EMACS_VERSION}/lisp

rm -f emacs emacs-${EMACS_VERSION}* buildobj.lst
touch buildobj.lst
LC_ALL=C ./temacs -batch -l loadup dump
rm -f emacs buildobj.lst

mv emacs-${EMACS_VERSION}.* emacs-${EMACS_VERSION}
rm -f %OPTWARE_TARGET_PREFIX%/bin/emacs-${EMACS_VERSION} %OPTWARE_TARGET_PREFIX%/bin/emacs
mv emacs-${EMACS_VERSION} %OPTWARE_TARGET_PREFIX%/bin/
ln -sf %OPTWARE_TARGET_PREFIX%/bin/emacs-${EMACS_VERSION} %OPTWARE_TARGET_PREFIX%/bin/emacs
